package main

import (
	"gitee.com/sunzheng86/gotask"
	log "github.com/sirupsen/logrus"
	"os"
)

const (
	uniqueJobName = "a-unique-job-name"
	redisURL      = "redis://10.185.129.33:6379/0"
	queueName     = "job-queue-name"
)

func main() {
	log.SetLevel(log.InfoLevel)
	log.SetReportCaller(true)
	log.SetOutput(os.Stdout)
	// set broker
	gotask.UseRedisBroker(redisURL, gotask.WithRedisTaskTTL(1000))

	// enqueue
	// or you can use a queue:
	queue := gotask.NewQueue(queueName, gotask.WithMaxLimit(10))
	queue.Enqueue(os.Args[1], gotask.MapToArgsMap(map[string]interface{}{"argument1":1, "argument2":"hello"})) // or gotasks.StructToArgsMap
}
